import 'package:freezed_annotation/freezed_annotation.dart';
import 'dart:convert';

part 'contribution_response.freezed.dart';
part 'contribution_response.g.dart';

@freezed
class ContributionResponse with _$ContributionResponse {
  const factory ContributionResponse({
    @JsonKey(name: "c") required int c,
    @JsonKey(name: "m") required String m,
    @JsonKey(name: "d") required List<D> d,
  }) = _ContributionResponse;

  factory ContributionResponse.fromJson(Map<String, dynamic> json) =>
      _$ContributionResponseFromJson(json);
}

@freezed
class D with _$D {
  const factory D({
    @JsonKey(name: "unit_id") required String unitId,
    @JsonKey(name: "unit_name") required String unitName,
    @JsonKey(name: "status") required String status,
    @JsonKey(name: "address") required String address,
    @JsonKey(name: "contact") required String contact,
    @JsonKey(name: "tel") required String tel,
    @JsonKey(name: "memo") required String memo,
    @JsonKey(name: "view_all") required String viewAll,
    @JsonKey(name: "list_order") required String listOrder,
    @JsonKey(name: "image") required String image,
    @JsonKey(name: "update_time") required String? updateTime,
  }) = _D;

  factory D.fromJson(Map<String, dynamic> json) => _$DFromJson(json);
}
